<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./lib/vue-2.5.9.js"></script>
</head>

<body>
  <div id="app">

    firstname：
    <input type="text" v-model="firstname" @keyup="txtChanged"> + lastname：
    <input type="text" v-model="lastname" @keyup="txtChanged"> = fullname：
    <input type="text" v-model="fullname">

  </div>

  <script>
    // 创建 Vue 实例，得到 ViewModel
    var vm = new Vue({
      el: '#app',
      data: {
        firstname: '',
        lastname: '',
        fullname: ''
      },
      methods: {
        txtChanged() {
          this.fullname = this.firstname + '-' + this.lastname
        }
      }
    });
  </script>
</body>

</html>